layui.use(["app", "carousel", "kbElement", "dropdown"], function () {
    let app = layui.app
    let carousel = layui.carousel
    let dropdown = layui.dropdown
    let kbElement = layui.kbElement

    let data = app.proxy({
        banner: [
            { image: "/images/banner-sm.png", title: "1440x200" }
        ]
    })

    /**
     * 渲染后
     */
    app.afterUpdate = function (bind) {
        // 幻灯片
        carousel.render({
            elem: bind.find("#banner"),
            width: '100%',
            height: '100%'
        });
        // 菜单
        dropdown.render({
            elem: bind.find(".kb-news-menu"),
            content: bind.find(".kb-news-box .layui-nav").html(),
            className: 'layui-nav layui-nav-tree',
            style: "position: absolute;",
            ready: function (elemPanel, elem) {
                kbElement.render('nav')
            }
        });
        // nav
        kbElement.render('nav', bind.find(".layui-nav"))
        // 面包屑
        kbElement.render('breadcrumb', bind.find(".layui-breadcrumb"));
    }
})